#!/usr/bin/env python
# -*- coding:utf-8 -*-


def get_headers(filename):
    headers = []
    headers_list = ['User-Agent', 'Cookie']
    with open(filename,'r') as fp:
        for line in fp.readlines():
            name, value = line.split(':', 1)
            if name in headers_list:
                headers.append((name.strip(), value.strip()))
    return headers


if __name__ == '__main__':
    headers = get_headers('request_head.py')
    print headers
